<template>
  <div class="loading" v-if="props.isLoading" :style="'height: calc(100% - ' + height + 'px)'">
    <a-spin :size="36" :tip="tip" />
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'

const props = defineProps({
  isLoading: { type: Boolean, default: false },
  height: { type: Number }
})
const tip = ref<string>('加载中 . . .')

onMounted(() => {
  window.electron.ipcRenderer.on('change-loading-text', (_, data: string) => {
    tip.value = data
  })
})
</script>
<style lang="scss" scoped>
.loading {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #fff;
  position: absolute;
  z-index: 999;
}
</style>
